#pragma
#include <iostream>
const int defaultvalue = 0;
enum
{
    ok = 0,
    div_zero,
    mod_zero,
    unknow,
};
const std::string opers = "+-*/%&()";
class Task
{
public:
    Task()
    {
    }
    Task(int x, int y, char oper)
        : _x(x), _y(y), _oper(oper), code(ok), result(defaultvalue)
    {
    }

    void Run()
    {
        switch (_oper)
        {
        case '+':
            result = _x + _y;
            break;

        case '-':
            result = _x - _y;
            break;

        case '*':
            result = _x * _y;
            break;

        case '/':
        {
            if (_y == 0)
                code = div_zero;
            else
                result = _x / _y;
        }
        break;

        case '%':
        {
            if (_y == 0)
                code = mod_zero;
            else
                result = _x % _y;
        }
        break;
        default:
            code = unknow;
            break;
        }
    }
    std::string print()
    {
        std::string s;
        s = std::to_string(_x);
        s += _oper;
        s += std::to_string(_y);
        s += "=?";
        return s;
    }
    std::string printresult()
    {
        std::string s;
        s = std::to_string(_x);
        s += _oper;
        s += std::to_string(_y);
        s += "=";
        s += std::to_string(result);
        s += "  ";
        s += std::to_string(code);
        return s;
    }
    ~Task()
    {
    }

private:
    int _x;
    int _y;
    char _oper;

    int result;
    int code; // 结果码，0可信，非0不可信。
};